# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-asn1-modules
pkgver=0.4.1
pkgrel=0
pkgdesc="A collection of ASN.1-based protocols modules"
url="https://pypi.org/project/pyasn1-modules"
arch="noarch"
license="BSD-2-Clause"
depends="py3-asn1"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pyasn1-modules/pyasn1_modules-$pkgver.tar.gz
	fix-tests-pyasn1-compat-octets.patch
	"
builddir="$srcdir"/pyasn1_modules-$pkgver

replaces="py-asn1-modules" # Backwards compatibility
provides="py-asn1-modules=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
d3716cafbfe940c5415cb59073897cd15d69b9723064ba581b7d573fe9a0fad9872d88517fe03b0db5b4fa93f8cd3254372e71d60ff5975013c97409b6c22d1d  pyasn1_modules-0.4.1.tar.gz
7d16b0c0da3718e1ecbce92fcef06660f5f73f424c83010c3a93d9a4597b177aea12b052fb7b1a044cb54ef0d6bb8406268cee4aba7dff47d50b973b0ed17161  fix-tests-pyasn1-compat-octets.patch
"
